package com.asiainfo.commons.dao.impl;

import java.util.HashMap;

import com.asiainfo.commons.bo.BOBsHttpServiceCfgEngine;
import com.asiainfo.commons.dao.interfaces.IBsHttpServiceCfgDAO;
import com.asiainfo.commons.ivalues.IBOBsHttpServiceCfgValue;

public class BsHttpServiceCfgDAOImpl implements IBsHttpServiceCfgDAO {

	@Override
	public IBOBsHttpServiceCfgValue getBsHttpServiceCfg(String username, String password, String interfaceCode)
			throws Exception {
		String sql = IBOBsHttpServiceCfgValue.S_Username + " = :username and " + IBOBsHttpServiceCfgValue.S_Password
				+ " =:password and " + IBOBsHttpServiceCfgValue.S_InterfaceCode + " = :interfaceCode";
		HashMap parameter = new HashMap();
		parameter.put("username", username);
		parameter.put("password", password);
		parameter.put("interfaceCode", interfaceCode);
		
		IBOBsHttpServiceCfgValue[] value = BOBsHttpServiceCfgEngine.getBeans(sql, parameter);
		if(value != null && value.length >0){
			return value[0];
		}else{
			return null;
		} 
	}

}
